package org.smr.dev;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;


public class JdbcConnectionUtils {

	/**
	 * 获取连接spring.jdbcTemplate.driver_class=com.mysql.jdbc.Driver
spring.jdbcTemplate.url=jdbc:mysql://localhost:3306/ministore?useUnicode=true&characterEncoding=UTF-8
spring.jdbcTemplate.username= root
spring.jdbcTemplate.password=123456
	 * @return
	 */
	public static Connection getConnection(){
		try {
			Class.forName("com.mysql.jdbc.Driver");
			String url = "jdbc:mysql://192.168.1.138:3306/weimi2?useUnicode=true&characterEncoding=UTF-8";
			String user = "root";
			String password = "123456";
			Properties properties = new Properties();
			properties.put("user", user);
			properties.put("password", password);
			properties.put("remarksReporting","true");//想要获取数据库结构中的注释，这个值是重点
			return (Connection) DriverManager.getConnection(url,properties);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
